<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Linux下配置Weblogic环境连接数据库的Bug</title>
    <style type="text/css" media="all">
      body {
        margin: 0;
        font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB", sans-serif;
        font-size: 14px;
        line-height: 20px;
        color: #777;
        background-color: white;
      }
      .container {
        width: 700px;
        margin-right: auto;
        margin-left: auto;
      }

      .post {
        font-family: Georgia, "Times New Roman", Times, "SimSun", serif;
        position: relative;
        padding: 70px;
        bottom: 0;
        overflow-y: auto;
        font-size: 16px;
        font-weight: normal;
        line-height: 25px;
        color: #515151;
      }

      .post h1{
        font-size: 50px;
        font-weight: 500;
        line-height: 60px;
        margin-bottom: 40px;
        color: inherit;
      }

      .post p {
        margin: 0 0 35px 0;
      }

      .post img {
        border: 1px solid #D9D9D9;
      }

      .post a {
        color: #28A1C5;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="post">
        <h1 class="title">Linux下配置Weblogic环境连接数据库的Bug</h1>
        <div class="show-content">
          <p>javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]<br></p><p>将WebLogic.jar添加到Add to library中。可是在执行时发现报错：<br></p><p>一：不自动识别jar为classes需要手动</p><p>Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/security/subject/AbstractSubject</p><p>如果将wlclient.jar也添加到路径时，会报错：</p><p>Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/security/acl/UserInfo</p><p>在Linux环境下，Oracle已经改变了weblogic包路径的内容，不能再像以前那样直接引用weblogic.jar.需要用到Weblogic提供的JarBuilder Tool。</p><p>方法(我的jdk是1.8)：</p><p>1、进入lib路径</p><p>cd/home/alic/WebLogic/Oracle/Middleware/Oracle_Home/wlserver/server/bin/</p><p>2、创建新的wlfullclient.jar包</p><p>java -jar wljarbuilder.jar</p><p>3、将创建的wlfullclient.jar添加到你的应用程序的Add to library下就可以了。</p>
        </div>
      </div>
    </div>
  </body>
</html>
